<%--
  Created by IntelliJ IDEA.
  User: 13095
  Date: 2024/11/9
  Time: 13:52
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<script src="${path}/static/js/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="${path}/static/css/style.css">
<script src="${path}/static/js/script.js"></script>
<html>
<body>
<div class="container">
    <header>
        <h1>评论列表</h1>
        <jsp:include page="inc/inc.jsp"></jsp:include>
    </header>
    <main>
        <table>
        <tr>
            <th>订单编号</th>
            <th>描述</th>
            <th>分数</th>
            <th>评论</th>
            <th>跑腿员</th>
            <th>用户</th>
            <th>评论时间</th>
        </tr>
            <c:forEach items="${requestScope.reviewsPageInfo.list}" var="review">
                <tr>
                    <td>${review.orders.orderNumber}</td>
                    <td>${review.task.description}</td>
                    <td>${review.score}</td>
                    <td>${review.comment}</td>
                    <td>${review.task.runner.runnerName}</td>
                    <td>${review.user.username}</td>
                    <td><fmt:formatDate value="${review.createdAt}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate> </td>
                </tr>
            </c:forEach>
        </table>
        <div class="pagination">
            <c:if test="${requestScope.reviewsPageInfo.hasPreviousPage}">
                <a href="${path}/manage/reviewList?page=${requestScope.reviewsPageInfo.pageNum - 1}"
                   title="上一页">上一页</a>
            </c:if>
            <c:forEach begin="1" end="${requestScope.reviewsPageInfo.pages}" var="pageNum">
                <c:choose>
                    <c:when test="${pageNum == requestScope.reviewsPageInfo.pageNum}">
                        <span class="current-page" title="当前页：${pageNum}">${pageNum}</span>
                    </c:when>
                    <c:otherwise>
                        <a href="${path}/manage/reviewList?page=${pageNum}" title="跳转到第 ${pageNum} 页">${pageNum}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
            <c:if test="${requestScope.reviewsPageInfo.hasNextPage}">
                <a href="${path}/manage/reviewList?page=${requestScope.reviewsPageInfo.pageNum + 1}"
                   title="下一页">下一页</a>
            </c:if>
        </div>
    </main>
</div>
</body>
</html>
